﻿<Application xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:doc="http://schemas.firstfloorsoftware.com/documenttoolkit"
             xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
             xmlns:toolkit="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit"
             x:Class="SamplePresentation.App"
             >
<Application.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="Assets/Brushes.xaml"/>
                <ResourceDictionary Source="Assets/Fonts.xaml"/>
                <ResourceDictionary Source="Assets/CoreStyles.xaml"/>
                <ResourceDictionary Source="Assets/Styles.xaml"/>
                <!--<ResourceDictionary Source="Assets/SdkStyles.xaml"/>-->
                <!--<ResourceDictionary Source="Assets/ToolkitStyles.xaml"/>
                To extend this theme to include the toolkit controls:
                1. Install the Silverlight Toolkit for Silverlight 4
                2. Add a Toolkit control to your project from the toolbox. This will add references to toolkit assemblies.
                3. Change the "Build Action" for ToolkitStyles.xaml to "Page"
                4. Uncomment the resource dictionary include above.
                
                If you do not intend to use toolkit controls, delete this comment and the ToolkitStyles.xaml file.-->
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>

        <Style TargetType="doc:ThumbnailListBox">
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="doc:ThumbnailListBox">
                        <ListBox x:Name="ListBox" BorderThickness="0" ScrollViewer.HorizontalScrollBarVisibility="Disabled"
                                 ItemsSource="{Binding DocumentDataSource.DefaultThumbnailCollection, RelativeSource={RelativeSource TemplatedParent}}">
                            <i:Interaction.Behaviors>
                                <doc:PageVirtualizer />
                            </i:Interaction.Behaviors>
                            <ListBox.ItemsPanel>
                                <ItemsPanelTemplate>
                                    <toolkit:WrapPanel />
                                </ItemsPanelTemplate>
                            </ListBox.ItemsPanel>
                            <ListBox.ItemTemplate>
                                <DataTemplate>
                                    <Grid Margin="4">
                                        <Border Background="White" BorderBrush="Black" BorderThickness="1">
                                            <Image Source="{Binding FixedPageThumbnail}" Width="{Binding FixedPageThumbnail.PixelWidth}" Height="{Binding FixedPageThumbnail.PixelHeight}" />
                                        </Border>
                                        <TextBlock Text="{Binding PageContent.PageNumber}"
                                           FontFamily="{StaticResource HeadingFontFamily}"
                                           FontSize="{StaticResource Heading1FontSize}"
                                           Foreground="{StaticResource ColorAccentBrush}"
                                           Margin="4,4,6,6"
                                           HorizontalAlignment="Right" VerticalAlignment="Bottom"/>
                                    </Grid>
                                </DataTemplate>
                            </ListBox.ItemTemplate>
                        </ListBox>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>

        <!-- 
	***************************************************************************
	OpacityButton (helper style used by other controls)
	***************************************************************************
	-->

        <Style x:Key="OpacityButton" TargetType="Button">
            <Setter Property="Padding" Value="0" />
            <Setter Property="HorizontalContentAlignment" Value="Stretch" />
            <Setter Property="VerticalContentAlignment" Value="Stretch" />
            <Setter Property="Cursor" Value="Hand" />
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="Button">
                        <Grid x:Name="Root" Background="Transparent">
                            <VisualStateManager.VisualStateGroups>
                                <VisualStateGroup x:Name="CommonStates">
                                    <VisualStateGroup.Transitions>
                                        <VisualTransition GeneratedDuration="00:00:00.2" />
                                        <VisualTransition GeneratedDuration="0" From="Pressed" />
                                        <VisualTransition GeneratedDuration="0" To="Pressed" />
                                    </VisualStateGroup.Transitions>
                                    <VisualState x:Name="Normal" />
                                    <VisualState x:Name="Pressed">
                                        <Storyboard>
                                            <DoubleAnimation Duration="0" Storyboard.TargetName="Translater" Storyboard.TargetProperty="Y" To="1" />
                                            <DoubleAnimation Duration="0" Storyboard.TargetName="ContentSite" Storyboard.TargetProperty="(FrameworkElement.Opacity)" To="1" />
                                        </Storyboard>
                                    </VisualState>
                                    <VisualState x:Name="MouseOver">
                                        <Storyboard>
                                            <DoubleAnimation Storyboard.TargetName="ContentSite" Storyboard.TargetProperty="(FrameworkElement.Opacity)" To="1" />
                                        </Storyboard>
                                    </VisualState>
                                    <VisualState x:Name="Disabled">
                                        <Storyboard>
                                            <DoubleAnimation Duration="0" To="0.25" Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="ContentSite" />
                                        </Storyboard>
                                    </VisualState>
                                </VisualStateGroup>
                            </VisualStateManager.VisualStateGroups>
                            <ContentPresenter x:Name="ContentSite" Opacity="0.5" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}">
                                <ContentPresenter.RenderTransform>
                                    <TranslateTransform Y="0" x:Name="Translater" />
                                </ContentPresenter.RenderTransform>
                            </ContentPresenter>
                        </Grid>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>

        <Style x:Key="ButtonBorder" TargetType="Border">
            <Setter Property="Background" Value="{StaticResource StaticControlBackground}"/>
            <Setter Property="CornerRadius" Value="2" />
            <Setter Property="Effect" Value="{StaticResource LightControlShadowEffect}" />
            <Setter Property="MinHeight" Value="28" />
            <Setter Property="MinWidth" Value="28" />
        </Style>

        <Style TargetType="doc:PageNavigator">
            <Setter Property="Background" Value="{StaticResource StaticControlBackground}"/>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="doc:PageNavigator">
                        <Grid x:Name="LayoutRoot">
                            <Grid.Resources>
                                <Style x:Key="PagingTextBoxStyle" TargetType="TextBox">
                                    <Setter Property="BorderThickness" Value="0"/>
                                    <Setter Property="Background" Value="{StaticResource InputBackgroundBrush}"/>
                                    <Setter Property="Foreground" Value="{StaticResource InputForegroundBrush}"/>
                                    <Setter Property="Padding" Value="2"/>
                                    <Setter Property="SelectionBackground" Value="{StaticResource InputSelectionBrush}"/>
                                    <Setter Property="Template">
                                        <Setter.Value>
                                            <ControlTemplate TargetType="TextBox">
                                                <Grid x:Name="RootElement">
                                                    <VisualStateManager.VisualStateGroups>
                                                        <VisualStateGroup x:Name="CommonStates">
                                                            <VisualState x:Name="Normal"/>
                                                            <VisualState x:Name="MouseOver"/>
                                                            <VisualState x:Name="Disabled">
                                                                <Storyboard>
                                                                    <DoubleAnimation To="0.55" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="DisabledVisualElement"/>
                                                                </Storyboard>
                                                            </VisualState>
                                                            <VisualState x:Name="ReadOnly">
                                                                <Storyboard>
                                                                    <DoubleAnimation To="1" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="ReadOnlyVisualElement"/>
                                                                </Storyboard>
                                                            </VisualState>
                                                        </VisualStateGroup>
                                                        <VisualStateGroup x:Name="FocusStates">
                                                            <VisualState x:Name="Focused">
                                                                <Storyboard>
                                                                    <DoubleAnimation Duration="0" Storyboard.TargetName="FocusVisualElement" Storyboard.TargetProperty="(FrameworkElement.Opacity)" To="1" />
                                                                </Storyboard>
                                                            </VisualState>
                                                            <VisualState x:Name="Unfocused" />
                                                        </VisualStateGroup>
                                                    </VisualStateManager.VisualStateGroups>
                                                    <Border x:Name="Border" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" CornerRadius="2" Opacity="1">
                                                        <Grid>
                                                            <Border x:Name="ReadOnlyVisualElement" Background="{StaticResource ReadOnlyBrush}" Opacity="0"/>
                                                            <ScrollViewer x:Name="ContentElement" BorderThickness="0" HorizontalAlignment="Left" IsTabStop="False" Padding="{TemplateBinding Padding}" VerticalAlignment="Center"/>
                                                        </Grid>
                                                    </Border>
                                                    <Border x:Name="DisabledVisualElement" Background="{StaticResource DisabledBrush}" CornerRadius="2" IsHitTestVisible="False" Opacity="0"/>
                                                    <Rectangle x:Name="FocusVisualElement" IsHitTestVisible="False" Margin="1" Opacity="0" RadiusX="1" RadiusY="1" Stroke="{StaticResource FocusVisualBrush}" StrokeThickness="{StaticResource FocusVisualStrokeThickness}" />
                                                </Grid>
                                            </ControlTemplate>
                                        </Setter.Value>
                                    </Setter>
                                </Style>
                            </Grid.Resources>
                            <Border Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="2" Effect="{StaticResource LightControlShadowEffect}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" MinHeight="28" Padding="{TemplateBinding Padding}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}">
                                <StackPanel Margin="8,0" Orientation="Horizontal" VerticalAlignment="Stretch">
                                    <Button x:Name="PreviousPage" Style="{StaticResource OpacityButton}" Width="16">
                                        <Path Data="M0,0.5 L1,1 1,0Z" Width="5" Height="8" Fill="#202020" Stretch="Fill" />
                                    </Button>
                                    <StackPanel x:Name="Separator1" Height="24" HorizontalAlignment="Right" Margin="4,2,6,2" Orientation="Horizontal" Width="2">
                                        <Rectangle Width="1">
                                            <Rectangle.Fill>
                                                <LinearGradientBrush EndPoint="1,1" StartPoint="0,0">
                                                    <GradientStop Color="#0000" Offset="0" />
                                                    <GradientStop Color="#3000" Offset="0.3" />
                                                    <GradientStop Color="#3000" Offset="0.7" />
                                                    <GradientStop Color="#0000" Offset="1" />
                                                </LinearGradientBrush>
                                            </Rectangle.Fill>
                                        </Rectangle>
                                        <Rectangle Width="1">
                                            <Rectangle.Fill>
                                                <LinearGradientBrush EndPoint="1,1" StartPoint="0,0">
                                                    <GradientStop Color="#0FFF" Offset="0" />
                                                    <GradientStop Color="#FFFF" Offset="0.3" />
                                                    <GradientStop Color="#AFFF" Offset="0.7" />
                                                    <GradientStop Color="#0FFF" Offset="1" />
                                                </LinearGradientBrush>
                                            </Rectangle.Fill>
                                        </Rectangle>

                                    </StackPanel>

                                    <StackPanel x:Name="NumericButtonPanel" Margin="1" Orientation="Horizontal"/>
                                    <StackPanel x:Name="PageDisplay" Orientation="Horizontal">
                                        <TextBlock Text="Page" Foreground="{TemplateBinding Foreground}" Margin="4,0" VerticalAlignment="Center"/>
                                        <TextBox x:Name="PageIndex" Foreground="{TemplateBinding Foreground}" Height="20" Style="{StaticResource PagingTextBoxStyle}" VerticalAlignment="Center" Width="40"/>
                                        <TextBlock Text="of" Foreground="{TemplateBinding Foreground}" Margin="4,0" VerticalAlignment="Center"/>
                                        <TextBlock x:Name="PageCount" Foreground="{TemplateBinding Foreground}" Margin="0,0,4,0" VerticalAlignment="Center"/>
                                    </StackPanel>

                                    <StackPanel x:Name="Separator2" Height="24" HorizontalAlignment="Right" Margin="6,2,4,2" Orientation="Horizontal">
                                        <Rectangle Width="1">
                                            <Rectangle.Fill>
                                                <LinearGradientBrush EndPoint="1,1" StartPoint="0,0">
                                                    <GradientStop Color="#0000" Offset="0" />
                                                    <GradientStop Color="#3000" Offset="0.3" />
                                                    <GradientStop Color="#3000" Offset="0.7" />
                                                    <GradientStop Color="#0000" Offset="1" />
                                                </LinearGradientBrush>
                                            </Rectangle.Fill>
                                        </Rectangle>
                                        <Rectangle Width="1">
                                            <Rectangle.Fill>
                                                <LinearGradientBrush EndPoint="1,1" StartPoint="0,0">
                                                    <GradientStop Color="#0FFF" Offset="0" />
                                                    <GradientStop Color="#FFFF" Offset="0.3" />
                                                    <GradientStop Color="#AFFF" Offset="0.7" />
                                                    <GradientStop Color="#0FFF" Offset="1" />
                                                </LinearGradientBrush>
                                            </Rectangle.Fill>
                                        </Rectangle>
                                    </StackPanel>

                                    <Button x:Name="NextPage" Style="{StaticResource OpacityButton}" Width="16">
                                        <Path Data="M0,0 L1,0.5 0,1Z" Width="5" Height="8" Fill="#202020" Stretch="Fill" />
                                    </Button>
                                </StackPanel>
                            </Border>
                        </Grid>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
    </Application.Resources>
</Application>
